// import './style.css'
// import javascriptLogo from './javascript.svg'
// import viteLogo from '/vite.svg'
// import { setupCounter } from './counter.js'

// document.querySelector('#app').innerHTML = `
//   <div>
//     <a href="https://vite.dev" target="_blank">
//       <img src="${viteLogo}" class="logo" alt="Vite logo" />
//     </a>
//     <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript" target="_blank">
//       <img src="${javascriptLogo}" class="logo vanilla" alt="JavaScript logo" />
//     </a>
//     <h1>Hello Vite!</h1>
//     <div class="card">
//       <button id="counter" type="button"></button>
//     </div>
//     <p class="read-the-docs">
//       Click on the Vite logo to learn more
//     </p>
//   </div>
// `

// setupCounter(document.querySelector('#counter'))


class H3 {
  constructor() {
    console.log(this,typeof this)
    this.name = "H3 Instance";
    this.fetch = this.fetch.bind(this);
    
  }

  async fetch(url) {
    console.log('Fetching data from:', this.name);
    try {
      const response = await fetch(url);
      if (!response.ok) {
        throw new Error(`HTTP error! status: ${response.status}`);
      }
      const data = await response.json();
      console.log('Data fetched:', data);
      return data;
    } catch (error) {
      console.error('Fetch failed:', error);
    }
  }
}

function executeCallback(callback) {
  callback("https://xuepaiapi.ooowin.com/qzkt/sms/captcha");
}
// 使用示例
const instance = new H3();
// instance.fetch('https://xuepaiapi.ooowin.com/qzkt/sms/captcha');

executeCallback(instance.fetch)